﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ListLocations.aspx.cs" Inherits="cs499.Locations.ListLocations" %>
<%@ MasterType VirtualPath="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content runat="server" ID="navbar" ContentPlaceHolderID="NavOptions">
    <ul>
        <li><asp:LinkButton ID="addBuildingbutton" runat="server" PostBackUrl="~/Locations/AddBuilding.aspx">Add Building</asp:LinkButton></li>
        <li><asp:LinkButton ID="addRoombutton" runat="server" PostBackUrl="~/Locations/AddRoom.aspx">Add Room</asp:LinkButton></li>
        <li><asp:LinkButton ID="deleteclassbutton" runat="server" PostBackUrl="~/Locations/DeleteLocations.aspx">Delete Location(s)</asp:LinkButton></li>
        <li><asp:LinkButton ID="importBuildingButton" runat="server" PostBackUrl="~/Locations/ImportBuilding.aspx">Import Building(s)</asp:LinkButton></li>
        <li><asp:LinkButton ID="importRoomButton" runat="server" PostBackUrl="~/Locations/ImportRoom.aspx">Import Room(s)</asp:LinkButton></li>
        <li><asp:LinkButton ID="exportBuildingButton" runat="server" OnClick="exportBuildingButton_Click">Export Building(s)</asp:LinkButton></li>
        <li><asp:LinkButton ID="exportRoomButton" runat="server" OnClick="exportRoomButton_Click">Export Room(s)</asp:LinkButton></li>
    </ul>
</asp:Content>
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
    <section class="featured">
        <div class="content-wrapper">
            <h3><asp:Label ID="ListActionMessage" runat="server" Text="" />  List of Locations For <asp:Label ID="DepartmentLabel" runat="server" Text="" /></h3>
        </div>
    </section>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="EntityDataSourceBuildings" AllowSorting="True">
        <Columns>
            <asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
        </Columns>
    </asp:GridView>
    <asp:EntityDataSource ID="EntityDataSourceBuildings" runat="server" ConnectionString="name=Model1Container" DefaultContainerName="Model1Container" EntitySetName="Places" EntityTypeFilter="Building" Where="it.Department.Id=@newparameter">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" DefaultValue="-1" Name="newparameter" SessionField="CurrentDepartmentId" />
        </WhereParameters>
    </asp:EntityDataSource>
    
    <asp:GridView ID="GridView2" runat="server" DataSourceID="EntityDataSourceRooms" AllowSorting="True" AutoGenerateColumns="False">
        <Columns>
            <asp:BoundField DataField="Building.Name" HeaderText="BuildingName" SortExpression="Building.Name" />
            <asp:BoundField DataField="Number" HeaderText="Number" SortExpression="Number" />
            <asp:BoundField DataField="Capacity" HeaderText="Capacity" SortExpression="Capacity" />
        </Columns>
    </asp:GridView>
    <asp:EntityDataSource ID="EntityDataSourceRooms" runat="server" ConnectionString="name=Model1Container" DefaultContainerName="Model1Container" EntitySetName="Places" EntityTypeFilter="Room" Where="it.Department.Id=@newparameter" Include="Building" Select="">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" DefaultValue="-1" Name="newparameter" SessionField="CurrentDepartmentId" />
        </WhereParameters>
    </asp:EntityDataSource>
    
</asp:Content>
